Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@types/prompts
Advanced tools
TypeScript definitions for prompts
@types/prompts provides TypeScript type definitions for the 'prompts' library, which is used to create interactive command-line prompts.
Basic Text Prompt
This feature allows you to create a basic text prompt where the user can input a string. The example asks for the user's name and then greets them.
const prompts = require('prompts');
(async () => {
const response = await prompts({
type: 'text',
name: 'value',
message: 'What is your name?'
});
console.log(`Hello, ${response.value}!`);
})();
Select Prompt
This feature allows you to create a select prompt where the user can choose from a list of options. The example lets the user pick a color from a list.
const prompts = require('prompts');
(async () => {
const response = await prompts({
type: 'select',
name: 'color',
message: 'Pick a color',
choices: [
{ title: 'Red', value: 'red' },
{ title: 'Green', value: 'green' },
{ title: 'Blue', value: 'blue' }
],
initial: 1
});
console.log(`You chose: ${response.color}`);
})();
Confirm Prompt
This feature allows you to create a confirm prompt where the user can answer with a yes or no. The example asks if the user wants to continue and logs the response.
const prompts = require('prompts');
(async () => {
const response = await prompts({
type: 'confirm',
name: 'value',
message: 'Do you want to continue?'
});
console.log(response.value ? 'Continuing...' : 'Aborted');
})();
Inquirer.js is a collection of common interactive command-line user interfaces. It provides similar functionalities to 'prompts' but with a more extensive set of features and customization options.
Enquirer is a stylish, intuitive, and user-friendly prompt system for Node.js. It offers similar functionalities to 'prompts' but focuses more on customization and user experience.
Vorpal is a framework for building interactive CLI applications. It provides similar prompt functionalities but also includes features for building more complex command-line interfaces.
npm install --save @types/prompts
This package contains type definitions for prompts (https://github.com/terkelg/prompts).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/prompts.
These definitions were written by Berkay GURSOY, Daniel Perez Alvarez, Kamontat Chantrachirathumrong, theweirdone, whoaa512, John Reilly, and Christopher Hiller.
FAQs
TypeScript definitions for prompts
The npm package @types/prompts receives a total of 193,885 weekly downloads. As such, @types/prompts popularity was classified as popular.
We found that @types/prompts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.